Skip to content

gh-144881: Add retry logic to asyncio debugging tools#148530

Merged
pablogsal merged 8 commits intopython:mainfrom
johnslavik:gh-144881-asyncio-tools-retry
Apr 13, 2026
Merged

gh-144881: Add retry logic to asyncio debugging tools#148530
pablogsal merged 8 commits intopython:mainfrom
johnslavik:gh-144881-asyncio-tools-retry

Conversation

@johnslavik
Copy link
Copy Markdown
Member

@johnslavik johnslavik commented Apr 13, 2026

@pablogsal Look at that thing! Zero errors! Amazing!

Screen.Recording.2026-04-13.at.23.24.22.mov

Compare to original:

Screen.Recording.2026-02-16.at.16.22.21.mov

(code used is in the issue)

Error path working too

Screenshot 2026-04-13 at 23 26 11

I also fixed error paths to write to stderr, not stdout (I know this was copied over from pdb), hope you don't mind (should be small enough).

Transient errors can occur when attaching to a process that is actively
using thread delegation (e.g. asyncio.to_thread). Add a retry loop to
_get_awaited_by_tasks for RuntimeError, OSError, UnicodeDecodeError, and
MemoryError, and expose --retries CLI flag on both `ps` and `pstree`
subcommands (default: 3).
Silent retries are less confusing; only report on final failure.
Co-authored-by: Stan Ulbrych <stan@python.org>
@pablogsal
Copy link
Copy Markdown
Member

@pablogsal Look at that thing! Zero errors! Amazing!

Amazing indeed 👑

Copy link
Copy Markdown
Member

@pablogsal pablogsal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flawless! Thanks a lot for working on this man ❤️

@pablogsal pablogsal enabled auto-merge (squash) April 13, 2026 21:41
@pablogsal pablogsal disabled auto-merge April 13, 2026 21:41
@pablogsal pablogsal enabled auto-merge (squash) April 13, 2026 21:41
@pablogsal pablogsal merged commit 4adffd9 into python:main Apr 13, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants